<template>
    <ElSelect filterable clearable :="$attrs">
        <ElOption v-for="item in options" :key="item.customerShopBusinessId" :label="item.ywmc"
            :value="item.customerShopBusinessId" />
    </ElSelect>
</template>

<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
import { ElSelect, ElOption } from 'element-plus'
import { getSfmsYwListByCustomerShopBusinessId } from '../api'

interface Props {
    data: any;
}
const props = withDefaults(defineProps<Props>(), {
    data: () => ({}),
})
const options = ref<Array<{ ywmc: string, customerShopBusinessId: number }>>([])

const getOptions = async (customerShopBusinessId) => {
    let res = await getSfmsYwListByCustomerShopBusinessId({ customerShopBusinessId });
    options.value = res;
}

onMounted(() => {

})

watch(() => props.data.customerShopBusinessId, () => {
    // 根据咨询记录ID查询该咨询记录信息
    getOptions(props.data.customerShopBusinessId);
})

</script>